﻿namespace CodingExercises._31_40;

public class Ticket
{
    // 活动票证的组合ID
    public string EventName { get; }
    public DateTime EventDate { get; }

    public Ticket(string eventName,DateTime eventDate)
    {
        EventName = eventName;
        EventDate = eventDate;
    }

    public override bool Equals(object obj)
    {
        if (obj is null || obj is not Ticket)
        {
            return false;
        }

        Ticket other = (Ticket)obj;
        return EventDate == other.EventDate &&
               EventName == other.EventName;
    }

    public override int GetHashCode()
    {
        return HashCode.Combine(EventName, EventDate);
    }
    
    
}